package com.xx.jicheng.controller.admin;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.yihang.common.spring.Inject;

import com.xx.jicheng.entity.Category;
import com.xx.jicheng.service.CategoryService;
import com.xx.jicheng.service.ConfigService;

@Controller
public class AdminCategoryController {
	
	@Autowired
	private CategoryService categoryService;

	@RequestMapping("/admin/product/category")
	public void category() {
		
	}
	
	@RequestMapping("/admin/product/category/find")
	@Cacheable(cacheNames="category.cache", key="'category.findAll'", condition="#configService.isCacheEnabled('category.cache.enable')")
	@ResponseBody
	public List<Category> find(@Inject ConfigService configService) {
		return categoryService.findAll();
	}
}
